home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_pyr_minesafetydoors.cog < prev    next >
Text File  |  1999-11-15  |  4KB  |  161 lines

  1. # Jones 3D Cog Script
  2. #
  3. # PYR_MineSafetyDoors.cog
  4. #
  5. # Mine safety doors at the end of the level. Global value informs next level if Indy has described the doors.
  6. #
  7. # [TRM] + [RKD]
  8. #
  9. # (C) 1999 LucasArts Entertainment Co. All Rights Reserved
  10. # ========================================================================================
  11.  
  12. symbols
  13.  
  14. message    startup
  15. message    entered
  16. message    activated
  17.  
  18. # world things
  19. thing    doorL
  20. thing    doorR
  21. thing    player        local
  22.  
  23. # camera things and look things
  24. thing    doorcam
  25. thing    doorcamlook
  26. thing    cam1spot    local
  27. thing    cam1look    local
  28.  
  29. # world surfaces
  30. surface    open    mask=0x404
  31.  
  32. # sounds
  33. sound    sndOpen=sol_cardoor_open_c.wav        local
  34. sound    sndClose=sol_cardoor_close_c.wav    local
  35.  
  36. # indy saylines
  37. sound    firesafety=pr15j01.wav    local
  38. sound    triggersit=pr15j02.wav    local
  39. end
  40.  
  41. # ========================================================================================
  42. code
  43.  
  44. startup:
  45.     sleep(.01);
  46.     player = GetLocalPlayerThing();
  47.  
  48.     # light up doors and remove visibility
  49.     SectorAdjoins(GetThingSector(doorL), 0);
  50.     SetThingLight(doorL, '.2 .2 .25', .001, 0.01);
  51.     SetThingLight(doorR, '.2 .2 .25', .001, 0.01);
  52.     
  53.     # global12 = 0 when Indy hasn't commented on the fire doors yet
  54.     global12 = 0;
  55.  
  56.     return;
  57.                             
  58. # ========================================================================================
  59.  
  60. activated:
  61. # ---> DoorL, DoorR    
  62.  
  63.     # stop player
  64.     if (MakeMeStop() == -1) return;
  65.     DeselectWeaponWait(player);
  66.     
  67.     # bring camera around, freeze Indy, say a few words
  68.     StartCutscene(0);
  69.     
  70.     # setup offset camera
  71.     cam1spot = CreateThing(GetThingTemplate(doorcam), doorcam);
  72.     cam1look = CreateThing(GetThingTemplate(doorcam), doorcam);
  73.     MakeCamera2LikeCamera1(cam1spot, cam1look);
  74.     SetCameraLookInterp(2, 0);
  75.     SetCameraPosInterp(2, 0);
  76.     SetCameraFocus(2, cam1spot);
  77.     SetCameraSecondaryFocus(2, cam1look);
  78.     SetCurrentCamera(2);
  79.     ResetCameraFOV(0, 0.0);
  80.     SetCameraLookInterp(2, 1);
  81.     SetCameraPosInterp(2, 1);
  82.     SetCameraInterpSpeed(2, 0.7);
  83.     Sleep(0.01);
  84.     SetCameraFocus(2, doorcam);
  85.     SetCameraSecondaryFocus(2, doorcamlook);
  86.  
  87.     Sleep(0.3);
  88.     
  89.     #if Indy hasn't tried the doors yet
  90.     if (global12 == 0)
  91.     {
  92.         PlayMode(player, 60, 0);
  93.         Sleep(1);
  94.         
  95.         PlayVoice(player, firesafety, 1, 1);
  96.         
  97.         #set global variable to indicate (and tell SOL) that first line was sprung
  98.         global12 = 1;
  99.     }
  100.     else
  101.     {
  102.            PlayVoice(player, triggersit, 1, 1);
  103.     }
  104.  
  105.     Sleep(0.75);
  106.     
  107.     # restore camera and get rid of objects
  108.     SetCameraLookInterp(2, 0);
  109.     SetCameraPosInterp(2, 0);
  110.     SetCameraPosition(1, GetThingPos(doorcam));
  111.     SetCurrentCamera(1);
  112.     DestroyThing(cam1spot);
  113.     DestroyThing(cam1look);
  114.     
  115.     # restore control
  116.     ClearActorFlags(player, 0x200000);
  117.     EndCutscene();
  118.     return;
  119.  
  120. entered:
  121. # ---> open surface
  122.     if (GetSenderRef() != open) return;
  123.  
  124.     if (!BitTest(GetPhysicsFlags(GetSourceRef()), 0x01000000)) return;
  125.     
  126.     # go into cutscene mode
  127.     StartCutscene(0);
  128.     StopThing(player);
  129.     SetActorFlags(player, 0x200000);
  130.     SetThingThrust(player, '0.0 2.0 0.0');
  131.         
  132.     # turn on adjoin, remove door collisions
  133.     SectorAdjoins(GetThingSector(doorL), 1);
  134.     SetCollideType(doorL, 0);
  135.     SetCollideType(doorR, 0);
  136.  
  137.     # play door sounds
  138.     PlaySoundThing(sndOpen, doorL, 0.5, 10.0, 20.0, 0);
  139.     PlaySoundThing(sndOpen, doorR, 0.5, 10.0, 20.0, 0);
  140.  
  141.     # open the doors
  142.     MoveToFrame(doorL, 1, 2.5);
  143.     MoveToFrame(doorR, 1, 2.5);
  144.     WaitForStop(doorL);
  145.     
  146.     # delay closing of the door
  147.     Sleep(3);
  148.     
  149.     #close the doors
  150.     MoveToFrame(doorL, 0, 2.5);
  151.     MoveToFrame(doorR, 0, 2.5);
  152.  
  153.     #play door sounds
  154.     PlaySoundThing(sndClose, doorL, 0.5, 10.0, 20.0, 0);
  155.     PlaySoundThing(sndClose, doorR, 0.5, 10.0, 20.0, 0);
  156.  
  157.     return;
  158.  
  159. end
  160.  
  161.